<?php
$conn=mysql_connect('localhost','root','') or die('Á¬½ÓÊ§°Ü£¡'.mysql_error());
mysql_select_db('xzpf',$conn) or die('Êý¾Ý¿âÑ¡ÔñÊ§°Ü:' . mysql_error());
mysql_query("set names utf8;"); //**ÉèÖÃ×Ö·û¼¯***
date_default_timezone_set('Asia/Shanghai');
error_reporting(0);

$query = mysql_query("SELECT leimu,shopid FROM shop WHERE zileimu = ''");
while ($row = mysql_fetch_assoc($query)) {
	$sql = mysql_query("SELECT id FROM zifenlei WHERE fenleiid = ".$row['leimu']." limit 1");
	$sql_row = mysql_fetch_assoc($sql);
	// var_dump($row['shopid']);
	var_dump("UPDATE shop set zileimu = ".$sql_row['id']." where shopid = ".$row['shopid']);
	// var_dump($sql_row['id']);
	$sql = mysql_query("UPDATE shop set zileimu = ".$sql_row['id']." where shopid = ".$row['shopid']);

}